import { drizzle } from "drizzle-orm/expo-sqlite";
import { openDatabaseSync } from "expo-sqlite";
import { useMigrations } from "drizzle-orm/expo-sqlite/migrator";
import migrations from "./migrations/migrations";

const setAppDateBase = openDatabaseSync('worksTask.db');
const database = drizzle(setAppDateBase);
const useMigrationsDb = () => {
  const { success, error } = useMigrations(database, migrations);
  return { success, error };
};

export { setAppDateBase, database, useMigrationsDb };
